Sync Orders
🛍️ Sync Order Request​
| Field | Details |
|---|---|
| API Name | SyncOrders |
| URL Format | <protocol>://<domain name:port>/<VirtualDir>/<URL> |
| Example URL | https://localhost:8080/OTPA/V1/SyncOrders |
| Description | This request is used to sync all orders available in the system. Upon receiving the Sync Order Request, the system sends state‑based order information messages. The request must contain jToken received in the Authentication response. |
📄 Sync Order Request Parameters​
The request contains the following elements:
| Parameter | Data Type | Description |
|---|---|---|
| jMessageType | varchar(15) | Must be sent as SYNC_ORDER_REQ |
| jManagerID | varchar(50) | Manager Identification Number |
| jCustomerId | varchar(50) | Customer ID assigned to the user |
| jExchange | int | Exchange identifier |
| jToken | varchar(512) | Authentication token received in Authentication API response |
| jEntrySequenceNumber | int64 | Last received sequence number; default is 0 if not provided |
| jRequestID | varchar(255) | Echo‑back field |
Example Sync Order Request​
{
"jMessageType": "SYNC_ORDER_REQ",
"jManagerID": "<MANAGER1>",
"jCustomerId": "<MEMBER>",
"jToken": "<Token received in Authentication Response>",
"jEntrySequenceNumber": "<max sequence number>",
"jRequestID": "<Echo back field>"
}
📥 Sync Order Response​
The response contains the following parameters:
| Parameter | Data Type | Description |
|---|---|---|
| jManagerId | varchar(50) | User ID assigned to the user |
| jCustomerId | varchar(50) | Customer ID assigned to the user |
| jLastSyncedPacket | int | Indicates whether this is the last packet: 1 = Last packet |
| jNoOfRecords | int | Number of order records included |
| jOrderMessage | Order Detail Structure | Array containing order details of size jNoOfRecords |
| jRequestID | varchar(255) | Echo‑back field |
| jResponseID | varchar(255) | System‑generated alphanumeric ID |
🧱 Order Detail Structure​
Each entry inside jOrderMessage array includes the following:
| Parameter (Key) | Data Type | Description |
|---|---|---|
| Order Number | int | Unique Order Number |
| Cli Order Number | int | Gateway/Client order number (system‑generated) |
| Exchange | varchar(10) | Exchange name |
| Scrip Token | int | Scrip token identifier |
| Symbol | float | Exchange‑provided security scrip name |
| Series | varchar(3) | Exchange-provided security series |
| InstrumentName | varchar(20) | Instrument name. Allowed values: • Equity = blank • Future Index = FUTIDX • Interest Rate Future = FUTINT • Future Stock = FUTSTK • Option Index = OPTIDX • Option Stock = OPTSTK • MCX/NCDEX Futures = FUTCOM • MCX Spot = COM • NCDEX Spot = COMDTY • NSE Currency Future = FUTCUR, FUTIRD, FUTIRT, OPTCUR • NSE Currency Spot = INDEX, UNDCUR, UNDIRD, UNDIRT |
| Expiry Date | varchar(10) | Expiry date in format ddMMMyyyy (e.g., 24JUN2004). Applicable for Futures and Options only; otherwise blank. |
| Strike Price | float | Exchange‑provided strike price (in rupees). Applicable for options only; otherwise -1. |
| Option Type | varchar(2) | Option type. Applicable for options only; otherwise blank. |
| Buy Sell | int | Buy/Sell flag: • 1 → Buy• 2 → Sell |
| Order Original Qty | int | Original order quantity |
| Pending Qty | int | Pending quantity |
| TradedQTY | int | Traded quantity |
| DQ | int | Disclosed quantity |
| Order Price | float | Order price (in rupees) |
| Trigger Price | float | Trigger price (in rupees) |
| Order Type | varchar(10) | Order type |
| Order Status | varchar(15) | Status of the order |
| Reason | varchar(300) | Reason for rejection (if any) |
| Order Validity | varchar(100) | Order validity |
| Pro/Cli | int | Participant flag: • 1 → CLI• 2 → PRO |
| User ID | varchar(10) | Client code (blank for PRO orders) |
| DealerCode | varchar(5) | Unique user identification code |
| Part Code | varchar(12) | Participant code; blank if not applicable |
| Order Entry Time | varchar(10) | Order entry timestamp (e.g., 15Jun2018 15.25.15) |
| Last Modified Time | varchar(10) | Order last modified timestamp (e.g., 15Jun2018 15.25.15) |
| Alias | varchar(5) | Alias ID; blank if not applicable |
| Product | varchar(5) | Product type of the order |
| Initiated By | varchar(25) | Application that initiated the order (e.g., ADMIN, NET) |
| Modified By | varchar(25) | Application that modified the order (e.g., ADMIN, NET) |
| Initiated By User Id | varchar(10) | User ID of the user who initiated the order |
| Modified By User Id | varchar(10) | User ID of the user who modified the order |
| Leg Indicator | int | Spread leg indicator |
| LocationID | varchar(5) | Location identifier (PIN + NSE CTCL Branch ID + NSE CTCL ID + Algo flag + Vendor code) |
| User Remarks | varchar(50) | User‑provided remarks |
| Misc | varchar(50) | Miscellaneous details. Possible values: • SPO-LMT• SPO-MKT• PO-MKT• PO-LMT |
| SpreadFlag | int | Spread type: • 1 → Spread• 0 → Normal |
| Spread Price | float | Spread price (in rupees) |
| AMO Order ID | varchar(50) | Order ID for AMO/EQGTD orders; otherwise blank |
| SequenceNo | int64 | Incremental sequence number |
| ManagerId | int | Manager ID |
| Days | int | Number of days (applicable for certain order validity types) |
| UniqueCode | varchar(12) | Alphanumeric value with special characters |
📝 Order Detail Structure (Additional Fields)​
| Parameter (Key) | Data Type | Description |
|---|---|---|
| OrderNumber | int | Unique Order Number |
| CliOrderNumber | int | Client/Gateway Order Number |
| Exchange | varchar(10) | Exchange |
| ScripToken | int | Scrip Token |
| Symbol | float | Exchange‑provided security scrip name |
| Series | varchar(3) | Exchange‑provided security series |
| InstrumentName | varchar(20) | Instrument name with valid values: • Equity = blank • Future Index = FUTIDX • Interest Rate Future = FUTINT • Future Stock = FUTSTK • Option Index = OPTIDX • Option Stock = OPTSTK • MCX/NCDEX Futures = FUTCOM • MCX Spot = COM • NCDEX Spot = COMDTY • NSE Currency Future = FUTCUR, FUTIRD, FUTIRT, OPTCUR • NSE Currency Spot = INDEX, UNDCUR, UNDIRD, UNDIRT |
| ExpiryDate | varchar(10) | Expiry date (ddMMMyyyy, e.g., 24JUN2004). Applicable for Futures & Options only; otherwise blank. |
| StrikePrice | float | Strike price (in rupees). Applicable for options only; otherwise -1. |
| OptionType | varchar(2) | Option type (applicable for options only; otherwise blank). |
| BuySell | int | Order direction: • 1 → Buy• 2 → Sell |
| OrderOriginalQty | int | Original order quantity |
| PendingQty | int | Pending order quantity |
| TradedQTY | int | Traded quantity |
| DQ | int | Disclosed quantity |
| OrderPrice | float | Order price (in rupees) |
| TriggerPrice | float | Trigger price (in rupees) |
| OrderType | varchar(10) | Order type |
| OrderStatus | varchar(15) | Current status of the order |
| Reason | varchar(300) | Reason for rejection (if applicable) |
| OrderValidity | varchar(100) | Order validity |
| Pro/Cli | int | Participant type: • 1 → CLI• 2 → PRO |
| UserID | varchar(10) | Client code (blank for PRO users) |
| DealerCode | varchar(5) | Unique user identification code |
| PartCode | varchar(12) | Participant code; blank if not applicable |
| OrderEntryTime | varchar(10) | Order entry timestamp (e.g., 15Jun2018 15.25.15) |
| LastModifiedTime | varchar(10) | Last modified timestamp (e.g., 15Jun2018 15.25.15) |
| Alias | varchar(5) | Alias ID (otherwise blank) |
| Product | varchar(5) | Product type |
| InitiatedBy | varchar(25) | Application that initiated the order (e.g., ADMIN, NET) |
| ModifiedBy | varchar(25) | Application that modified the order |
| InitiatedByUserId | varchar(10) | User ID who initiated the order |
| ModifiedByUserId | varchar(10) | User ID who modified the order |
| LegIndicator | int | Spread leg indicator |
| LocationID | varchar(5) | Location ID (PIN + NSECTCLBRANCH ID + NSECTCLID + ALGO FLAG + VENDOR CODE) |
| UserRemarks | varchar(10) | User-provided remarks |
| Misc | varchar(50) | Miscellaneous values: • SPO-LMT• SPO-MKT• PO-MKT• PO-LMT |
| SpreadFlag | int | Spread flag: • 1 → Spread• 0 → Normal |
| SpreadPrice | float | Spread price (in rupees) |
| AMOOrderID | varchar(50) | Order ID for AMO orders; otherwise blank |
| SequenceNo | int | Incremental Number |
Sync Order Response – Example​
{
"jData": {
"ManagerID": "KOTAL_10.0.0.1",
"CustomerId": "KOTAK",
"NoOfRecords": 6,
"OrderDetail": [
{ "MessageCode": 2000, "OrderNumber": 1, "...": "..." },
{ "MessageCode": 2000, "OrderNumber": 2, "...": "..." },
{ "MessageCode": 2000, "OrderNumber": 3, "...": "..." },
{ "MessageCode": 2000, "OrderNumber": 4, "...": "..." },
{ "MessageCode": 2000, "OrderNumber": 5, "...": "..." },
{ "MessageCode": 2000, "OrderNumber": 6, "...": "..." }
]
}
}